#ifndef ACCESSLIST_H
#define ACCESSLIST_H

#include <limits.h>
#include "configuration.h"
#include "stringlist.h"

typedef struct {
	char path[PATH_MAX];
	size_t len;
	stringlist_t authlist;
} access_t;

typedef struct {
	access_t *records;
	off_t *index;

	size_t size;
	size_t used;
} accesslist_t;

void accesslist_init (accesslist_t *accesslist);
void accesslist_free (accesslist_t *accesslist);

int accesslist_load (accesslist_t *accesslist, configuration_t *conf, const char *host_name);

int accesslist_insert (accesslist_t *accesslist, const char *path, size_t pathlen, const char *auth, size_t authlen);

int accesslist_allow (accesslist_t *accesslist, const char *path, size_t pathlen, const char *auth, size_t authlen);

#endif /* ACCESSLIST_H */
